 
 *******************
* Exporting representativeness table for Global South COVID paper
* 2020-09-22
* last updated: 2020-09-22
* Magdalena Larreboure
*******************

set more off
gl weight hh_weight

use "$da/KEN1_reptable.dta" , clear

loc dimensions rural hhsize female completesecondary consumption


********************************************************************************************************
********************************************************************************************************
********************************************************************************************************

local sR *
local sig1 `sR'
local sig2 `sR'`sR'
local sig3 `sR'`sR'`sR'
local formatDisp %10.2f

	
*Complete sample
	foreach var of varlist `dimensions' {
	qui sum `var' [aw=$weight] if covid_sample==1
	loc mw_`var':  di %10.2fc r(mean)
	qui sum `var'  if covid_sample==1
	loc muw_`var':  di %10.2fc r(mean)
	qui sum `var'_el1 if el1_sample==1 //[aw=$weight]
	loc mpop_`var':  di %10.2fc r(mean)
		
}
	clear all
	set obs 5
	g rural=0
	replace rural = 1 in 1	
	g hhsize=0
	replace hhsize = 1 in 2
	g female=0
	replace female = 1 in 3
	g completesecondary=0
	replace completesecondary = 1 in 4
	g consumption=0
	replace consumption = 1 in 5

		g muw  = ""	
		g mw   = ""	
		g mpop = ""

			
	
			replace mw   = "`mw_rural'" if rural==1
			replace muw   = "`muw_rural'" if rural==1
			replace mpop   = "`mpop_rural'" if rural==1
			replace mw   = "`mw_hhsize'" if hhsize==1
			replace muw   = "`muw_hhsize'" if hhsize==1
			replace mpop   = "`mpop_hhsize'" if hhsize==1
			replace mw   = "`mw_female'" if female==1
			replace muw   = "`muw_female'" if female==1
			replace mpop   = "`mpop_female'" if female==1
			replace mw   = "`mw_completesecondary'" if completesecondary==1
			replace muw   = "`muw_completesecondary'" if completesecondary==1
			replace mpop   = "`mpop_completesecondary'" if completesecondary==1
			replace mw   = "`mw_consumption'" if consumption==1
			replace muw   = "`muw_consumption'" if consumption==1
			replace mpop   = "`mpop_consumption'" if consumption==1
	
	
	drop rural hhsize female completesecondary consumption
 	export excel using "$dtab/Representativeness Table.xlsx", sheetmodify cell(C59)
